const { defineConfig } = require("@vue/cli-service");
const timeStamp = new Date().getTime()
module.exports = defineConfig({
  transpileDependencies: true,
  // publicPath: "/dist/",
  devServer: {
    proxy: {
      "/red": {
        target: "http://opac.zptsgg.com:9004/prod-api",
        changeOrigin: true,
        pathRewrite: {
          "^/red": "",
        },
      },
    },
  },
  configureWebpack: {
    // 打包后.js文件名添加时间戳,存放在js/
    // webpack打包的时候只会处理JS之间的依赖关系;下方处理css
    output: {
      filename: `js/[name].${timeStamp}.js`,
      chunkFilename: `js/[name].${timeStamp}.js`,
    },
  },
  css: {
    // 重点.
    extract: {
      // 打包后css文件名称添加时间戳
      filename: `css/[name].${timeStamp}.css`,
      chunkFilename: `css/chunk.[id].${timeStamp}.css`,
    },
  }
});
